<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
		<META http-equiv=Content-Type content="text/html; charset=utf-8">
		<LINK href="../styles/sciencee.css"  type=text/css rel=stylesheet>
		<style type="text/css"></style>
		<title>CGProject</title>
		<html:base/>
</head>
<%String sectorId = (String)request.getAttribute("SectorId"); %>
<body>

	<!--input type="text" name="LdrID" size="20" style="font-family: Tahoma; font-size: 11px" value=-->
	<table border="0" width="100%" cellspacing="1" id="table1" style="border: 1px solid #C0C0C0">
		<tr>
			<td height="25" bgcolor="#DFE6EF" colspan="2">&nbsp;<b><bean:message key="department"/>&nbsp; <bean:message key="management"/></b></td>
		</tr>
		<logic:equal name="Flag" value="CompanyIn">
		<tr>
			<td height="25" bgcolor="#EEF2F7" colspan="2">
			&nbsp; <b><bean:message key="currentcompany"/>:<logic:present name="SectorName" scope="request"><bean:write name="SectorName" scope="request"/></logic:present>	
			</b></td>
		</tr>
		<tr>
			<td height="25" width="15%">&nbsp; <bean:message key="company"/>&nbsp;:</td>
			<td height="25" width="85%"><logic:present name="SectorName" scope="request"><bean:write name="SectorName" scope="request"/></logic:present></td>
		</tr>
		</logic:equal>
		<logic:equal name="Flag" value="SectorIn">
		<tr>
			<td height="25" bgcolor="#EEF2F7" colspan="2">
			&nbsp; <b><bean:message key="current"/>&nbsp; <bean:message key="department"/>:<logic:present name="SectorName" scope="request"><bean:write name="SectorName" scope="request"/></logic:present>
			
			<html:link page="/index.do" paramId="SectorID" paramName="ParentId">[<bean:message key="up"/>]</html:link>
			</b></td>
		</tr>
		<tr>
			<td height="25" width="15%">&nbsp; <bean:message key="department"/> <bean:message key="name"/> :</td>
			<td height="25" width="85%"><logic:present name="SectorName" scope="request"><bean:write name="SectorName" scope="request"/></logic:present></td>
		</tr>
		
		<html:form action="/changeSecLeader" onsubmit="return  submitChangeSecLeader()">
		<tr>
			
			<td height="25" width="15%" valign="top">&nbsp; <bean:message key="department"/><bean:message key="manager"/> :</td>
			<td height="25" width="85%" valign="top" style="letter-spacing: -0pt">
			<html:hidden property="sectorId" value="<%=sectorId %>"/>
			<html:text property="leaderId" size="20" style="border:1px solid #C0C0C0; font-family: Tahoma; font-size: 11px" readonly="true"/>
			<input type="button" value='<bean:message key="select"/><bean:message key="manager"/>' name="B5" style="font-family: Tahoma; font-size: 11px" onclick="openwin('<%=request.getContextPath() %>/sector/intoQuery.do?Flag=1&SectorID=<%=sectorId %>')">
			(<bean:message key="current"/>:<logic:present name="LeaderName" scope="request"><bean:write name="LeaderName" scope="request"/></logic:present>)</td>
		</tr>
		<tr>
			<td height="25" width="100%" colspan="2">&nbsp;
			<html:submit property="submit" style="font-family: Tahoma; font-size: 11px"><bean:message key="basicmodify"/></html:submit>
		</html:form>
		<html:form action="/deleteSec">
			<html:hidden property="sectorId" value="<%=sectorId %>"/>
			<html:submit property="submit" style="font-family: Tahoma; font-size: 11px"><bean:message key="delete"/></html:submit>
		</html:form>
			</td>
		</tr>
		</logic:equal>
		<tr>
			<td height="25" colspan="2" style="border-bottom: 1px solid #C0C0C0">&nbsp; <font color="#990000"><b><bean:message key="subdivisionofthedepartment"/></b></font>
			<logic:equal name="NullTag"  value="Null"><font color=#990000>&nbsp;&nbsp;[<bean:message key="nosubdivision"/>]</font></logic:equal>
			</td>
		</tr>
		<logic:iterate id="element" name="SectorNames" >
		<tr>
			<td height="25" colspan="2" style="border-bottom: 1px dotted #C0C0C0">&nbsp;&nbsp;<html:link page="/index.do" paramId="SectorID" paramName="element" paramProperty="sectorId">
				<b>&nbsp;<img border="0" src="../image/arrow_right.gif"><b>&nbsp;
					<bean:write name="element" property="sectorName"/>
				</b>
			</html:link></td>
		</tr>
		</logic:iterate>
		<tr>
			<td height="25" colspan="2" bgcolor="#EEF2F7">&nbsp; <b><bean:message key="addsubdivisiondepartment"/></b></td>
		</tr>
		<html:form action="/addSec" onsubmit="return  submitAddSec()">
		<tr>
			<td height="25" width="15%">&nbsp;<bean:message key="department"/><bean:message key="name"/> :</td>
			<td height="25" width="85%"><html:text property="sectorName" size="20" style="border:1px solid #C0C0C0; font-family: Tahoma; font-size: 11px" /></td>
		</tr>
		<tr>
			<td height="25" width="15%">&nbsp; <bean:message key="department"/><bean:message key="manager"/> :</td>
			<td height="25" width="85%">
			<html:text property="leaderId" size="20" style="border:1px solid #C0C0C0; font-family: Tahoma; font-size: 11px" readonly="true"/>
						<input type="button" value='<bean:message key="select"/><bean:message key="manager"/>' name="B5" style="font-family: Tahoma; font-size: 11px" onclick="openwin('<%=request.getContextPath() %>/sector/intoQuery.do?Flag=2&SectorID=<%=sectorId %>')"></td>
		</tr>
		<tr>
			<td height="25" width="15%">&nbsp;
			<html:hidden property="parentId" value="<%=sectorId %>"/>
			<html:submit property="submit" style="font-family: Tahoma; font-size: 11px"><bean:message key="add"/></html:submit></td>
			<td height="25" width="85%"> </td>
		</tr>
		</html:form>
	</table>
</body>
</html:html>
<script language="javaScript">


	function isEmpty(theField)
	{
		if(theField.value=="")
			return true;
		else
		return false;
	}
	function submitAddSec()
	{
		var emptyField=0;
	 	if(isEmpty(window.document.addSecForm.sectorName)==true)
 		{
     		alert('<bean:message key="putinthedepartmentname"/>!');
     		window.document.addSecForm.sectorName.focus();
     		return false;
 		}
     	window.document.addSecForm.submit();
	 }
	 function submitChangeSecLeader()
	 {
		if(isEmpty(window.document.changeSecLeaderForm.leaderId)==true)
		{
			alert("<<bean:message key="select"/><bean:message key="manager"/>!");
			window.document.changeSecLeaderForm.leaderId.focus();
			return false;
		}
	 	window.document.changeSecLeaderForm.submit();
	 }
	 function openwin(url)
	 {
				 	
			window.open(url,'newwindow','width=400,height=200');
		
	}
</script>
	<SCRIPT language="javascript" src="./js/ciphering.js"></SCRIPT>

